🔄 Update Entity from Any System (Generic Connector)
Overview
SyncNow enables information from any system to be published easily into work system entities such as epics, features, stories, or any other entity.
This article explains how to set up generic system adapter notifications to publish data from any source into your work systems.
💡 Usage Examples
- Publish build information (such as build version) into work system entities.
- Link entities to build URLs or mention the build URL in comments.
- Publish security or work progress updates to work system entities.
- Update security status for entities mentioned in comments or a specific entity.
- Create a security bug in the developer management work system.
- Create and monitor live incidents from production systems.
📝 Step-by-Step Instructions
1️⃣ Create a Generic Connector
-
Set the connector name, image, and base URL.
-
Recommendation: Set an IP address or IP range to restrict connector webhooks into SyncNow for security.
2️⃣ Create a DevOps Gate Process
-
For example, configure a process for SonarQube Scan Status as shown below.
3️⃣ Map Entities and Fields
-
Map the SyncNow virtual entity (representing generic data) to a target entity in your work system.
-
You can define different mappings for each entity type.
4️⃣ Example: Publish Build Information
Below is a Jenkins Groovy function to publish build information and comments to SyncNow using the API.
@NonCPS
def getCommentsString() {
def list = []
def changeLogSets = currentBuild.changeSets
for (int i = 0; i < changeLogSets.size(); i++) {
def entries = changeLogSets[i].items
for (int j = 0; j < entries.length; j++) {
def entry = entries[j]
if (entry.msg != null) {
list.add("""${entry.commitId} on ${new Date(entry.timestamp)}: ${entry.msg.replaceAll("[\n\r]", " ")}""")
}
}
}
return list.join(',')
}
def PublishBuildInformation() {
// Publish Build URL into comments
def commits = getCommentsString()
def payload = """
[
{
"eventRelativeURL": "/job/${JOB_NAME}/${env.BUILD_ID}",
"comments": "${commits}",
"commentLinkTitle": "Item Published in Build '${JOB_NAME}', version ${env.VERSION}.${env.BUILD_ID}"
}
]
"""
string responseComment = httpRequest acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_JSON', httpMode: 'POST', authentication: 'SyncNow', requestBody: "${payload}", url: "https://<SyncNowServer>/api/v1.0/DevOpsGate/Enrich/<DevOpsGateProcessID>?action=comment"
println("Comment Entity Status: ${responseComment.status}")
println("Comment Entity Content: ${responseComment.content}")
// Publish Build version number into a field in work system entity
def payloadVer = """
[
{
"fields": [
{ "key": "Param1", "value": "${env.VERSION}.${env.BUILD_ID}" }
],
"comments": "${commits}"
}
]
"""
string responseVer = httpRequest acceptType: 'APPLICATION_JSON', contentType: 'APPLICATION_JSON', httpMode: 'POST', authentication: 'SyncNow', requestBody: "${payloadVer}", url: "https://<SyncNowURL>/api/v1.0/DevOpsGate/Enrich/<DevOpsGateProcessID>?action=update"
println("Comment Entity Status: ${responseVer.status}")
println("Comment Entity Content: ${responseVer.content}")
}
5️⃣ Define Custom Parameters
- Create custom parameters (e.g.,
Param1
). - These parameters must be set in the POST API payload to update, create, comment, or link to an entity.
6️⃣ Use the Correct API Endpoints
-
Create an entity:
{SyncNowBackend}/api/v1.0/DevOpsGate/Enrich/{DevOpsGateProcessID}?action=create
-
Update an entity:
{SyncNowBackend}/api/v1.0/DevOpsGate/Enrich/{DevOpsGateProcessID}?action=update
-
Add a comment with a link:
{SyncNowBackend}/api/v1.0/DevOpsGate/Enrich/{DevOpsGateProcessID}?action=comment
-
Link a relative URL from the generic connector to an entity:
{SyncNowBackend}/api/v1.0/DevOpsGate/LinkIt/{DevOpsGateProcessID}
7️⃣ Verify Data Publication
-
Ensure your script is running and data is being published to SyncNow.
Tip:
Use IP restrictions and parameter mapping to secure and customize your integration.
Automate publishing of build, security, or incident data from any system into your work management tools with SyncNow.